﻿using SmartLib.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace SmartLib.Tests
{
	
	
	/// <summary>
	///This is a test class for ServiceLocatorTest and is intended
	///to contain all ServiceLocatorTest Unit Tests
	///</summary>
	[TestClass()]
	public class ServiceLocatorTest
	{
		private TestContext testContextInstance;

		/// <summary>
		///Gets or sets the test context which provides
		///information about and functionality for the current test run.
		///</summary>
		public TestContext TestContext
		{
			get
			{
				return testContextInstance;
			}
			set
			{
				testContextInstance = value;
			}
		}

		/// <summary>
		/// Registers the test.
		/// </summary>
		[TestMethod]
		public void RegisterTest()
		{
			var fromType = typeof(ISimpleTestClass);
			var toType = typeof(SimpleTestClass);
			ServiceLocator.Instance.Register(fromType, toType, false);
			Assert.Inconclusive("Registered type {0} with {1}", fromType, toType);
		}

		/// <summary>
		///A test for Resolve Method
		///</summary>
		[TestMethod]
		public void ResolveTest()
		{
			RegisterTest();

			var actual = ServiceLocator.Instance.Resolve<ISimpleTestClass>();
			Assert.IsNotNull(actual);
		}
	}

	public interface ITestClass
	{
		
	}

	public class TestClass : ITestClass
	{
		public TestClass(ISimpleTestClass obj)
		{
			
		}
	}

	public interface ISimpleTestClass
	{

	}

	public class SimpleTestClass : ISimpleTestClass
	{

	}
}
